Passed
Pull Request — master (#351)
by
unknown
02:04
created

UserSeeder.run   A

Complexity

Conditions 1

Size

Total Lines 20
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 20
c 0
b 0
f 0
rs 9.5
cc 1
1
import { DataSource } from 'typeorm';
2
import { Seeder } from '@jorgebodega/typeorm-seeding';
3
import { User, UserRole } from 'src/Domain/HumanResource/User/User.entity';
4
5
export default class UserSeeder extends Seeder {
6
  async run(dataSource: DataSource) {
7
    const johnDoe = new User(
8
      'john',
9
      'doe',
10
      '[email protected]',
11
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
12
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
13
      UserRole.COOPERATOR
14
    );
15
16
    const isabelOrtega = new User(
17
      'Isabel',
18
      'Ortega',
19
      '[email protected]',
20
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
21
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
22
      UserRole.COOPERATOR
23
    );
24
25
    await dataSource.createEntityManager().save<User>([johnDoe, isabelOrtega]);
26
  }
27
}
28